home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming All in One / 3D Game Programming All in One Disc.iso / 3D2E / RESOURCES / KOOB / common / ui / LoadFileDlg.gui < prev    next >
Encoding:
Text File  |  2005-11-23  |  6.1 KB  |  207 lines

  1. //--- OBJECT WRITE BEGIN ---
  2. new GuiControl(LoadFileDlg) {
  3.    Profile = "GuiDialogProfile";
  4.    HorizSizing = "right";
  5.    VertSizing = "bottom";
  6.    Position = "0 0";
  7.    Extent = "800 600";
  8.    MinExtent = "8 8";
  9.    Visible = "1";
  10.       fitParentHeight = "0";
  11.       fitParentWidth = "0";
  12.       helpTag = "0";
  13.  
  14.    new GuiWindowCtrl() {
  15.       Profile = "GuiWindowProfile";
  16.       HorizSizing = "center";
  17.       VertSizing = "center";
  18.       Position = "36 33";
  19.       Extent = "589 372";
  20.       MinExtent = "8 8";
  21.       Visible = "1";
  22.       text = "Open File...";
  23.       maxLength = "255";
  24.       resizeWidth = "1";
  25.       resizeHeight = "1";
  26.       canMove = "1";
  27.       canClose = "1";
  28.       canMinimize = "1";
  29.       canMaximize = "1";
  30.       MinSize = "50 50";
  31.       closeCommand = "Canvas.popDialog(LoadFileDlg);";
  32.          fitParentHeight = "0";
  33.          fitParentWidth = "0";
  34.          helpTag = "0";
  35.  
  36.       new GuiButtonCtrl() {
  37.          Profile = "GuiButtonProfile";
  38.          HorizSizing = "left";
  39.          VertSizing = "top";
  40.          Position = "449 343";
  41.          Extent = "60 20";
  42.          MinExtent = "8 8";
  43.          Visible = "1";
  44.          Command = "DoOpenFileExCallback();";
  45.          text = "Load";
  46.          groupNum = "-1";
  47.          buttonType = "PushButton";
  48.             fitParentHeight = "0";
  49.             fitParentWidth = "0";
  50.             helpTag = "0";
  51.       };
  52.       new GuiButtonCtrl() {
  53.          Profile = "GuiButtonProfile";
  54.          HorizSizing = "left";
  55.          VertSizing = "top";
  56.          Position = "519 343";
  57.          Extent = "60 20";
  58.          MinExtent = "8 8";
  59.          Visible = "1";
  60.          Command = "Canvas.popDialog(LoadFileDlg);";
  61.          text = "Cancel";
  62.          groupNum = "-1";
  63.          buttonType = "PushButton";
  64.             fitParentHeight = "0";
  65.             fitParentWidth = "0";
  66.             helpTag = "0";
  67.       };
  68.       new GuiFrameSetCtrl() {
  69.          Profile = "GuiDefaultProfile";
  70.          HorizSizing = "width";
  71.          VertSizing = "height";
  72.          Position = "4 24";
  73.          Extent = "579 310";
  74.          MinExtent = "8 2";
  75.          Visible = "1";
  76.          columns = "0 245";
  77.          rows = "0";
  78.          borderWidth = "7";
  79.          borderColor = "206 206 206 206";
  80.          borderEnable = "dynamic";
  81.          borderMovable = "dynamic";
  82.          autoBalance = "0";
  83.          fudgeFactor = "0";
  84.  
  85.          new GuiScrollCtrl() {
  86.             Profile = "GuiScrollProfile";
  87.             HorizSizing = "right";
  88.             VertSizing = "bottom";
  89.             Position = "0 0";
  90.             Extent = "238 310";
  91.             MinExtent = "8 2";
  92.             Visible = "1";
  93.             willFirstRespond = "1";
  94.             hScrollBar = "dynamic";
  95.             vScrollBar = "dynamic";
  96.             constantThumbHeight = "0";
  97.             childMargin = "0 0";
  98.                fitParentHeight = "1";
  99.                fitParentWidth = "0";
  100.  
  101.             new GuiDirectoryTreeCtrl(LoadDirTreeEx) {
  102.                Profile = "GuiDirectoryTreeProfile";
  103.                HorizSizing = "right";
  104.                VertSizing = "bottom";
  105.                Position = "2 2";
  106.                Extent = "85 63";
  107.                MinExtent = "8 2";
  108.                Visible = "1";
  109.                tabSize = "16";
  110.                textOffset = "2";
  111.                fullRowSelect = "0";
  112.                itemHeight = "21";
  113.                destroyTreeOnSleep = "0";
  114.                MouseDragging = "0";
  115.                MultipleSelections = "0";
  116.                   fitParentHeight = "0";
  117.                   fitParentWidth = "0";
  118.             };
  119.          };
  120.          new GuiScrollCtrl() {
  121.             Profile = "GuiScrollProfile";
  122.             HorizSizing = "right";
  123.             VertSizing = "bottom";
  124.             Position = "245 0";
  125.             Extent = "334 310";
  126.             MinExtent = "8 2";
  127.             Visible = "1";
  128.             willFirstRespond = "1";
  129.             hScrollBar = "alwaysOn";
  130.             vScrollBar = "alwaysOn";
  131.             constantThumbHeight = "0";
  132.             childMargin = "0 0";
  133.                fitParentHeight = "1";
  134.                fitParentWidth = "1";
  135.  
  136.             new GuiDirectoryFileListCtrl(LoadFileListEx) {
  137.                Profile = "GuiDirectoryFileListProfile";
  138.                HorizSizing = "right";
  139.                VertSizing = "bottom";
  140.                Position = "2 2";
  141.                Extent = "623 208";
  142.                MinExtent = "8 2";
  143.                Visible = "1";
  144.                enumerate = "0";
  145.                resizeCell = "1";
  146.                columns = "0";
  147.                fitParentWidth = "1";
  148.                clipColumnText = "0";
  149.                   fitParentHeight = "0";
  150.             };
  151.          };
  152.       };
  153.    };
  154. };
  155. //--- OBJECT WRITE END ---
  156.  
  157.  
  158. //------------------------------------------------------------------------------
  159. // ex: getLoadFilename("~/stuff/*.*", openStuff);
  160. //     -- calls 'openStuff(%filename)' on dblclick or ok
  161. //------------------------------------------------------------------------------
  162. function getLoadFilename(%filespec, %callback, %currentFile)
  163. {
  164.   $GuiLoadDialogCallback = %callback;   
  165.   if( %filespec $= "" )
  166.    $LoadFileExFileSpec = "*.*";
  167.   else
  168.    $LoadFileExFileSpec = %filespec;
  169.  
  170.   Canvas.pushDialog(LoadFileDlg, 99);
  171.  
  172.   $LoadFileExFile = %currentFile;
  173.  
  174.    // If we have a current path, set the tree to it
  175.    if( filePath( %currentFile ) !$= "" )
  176.       LoadDirTreeEx.setSelectedPath( filePath( %currentFile ) );
  177.       
  178.    // Update our file view to reflect the changes
  179.    LoadFileListEx.setPath( LoadDirTreeEx.getSelectedPath(), $LoadFileExFileSpec );
  180. }
  181.  
  182.  
  183. //--------------------------------------
  184. function DoOpenFileExCallback()
  185. {
  186.   %path = LoadDirTreeEx.getSelectedPath();
  187.   %file = LoadFileListEx.getSelectedFile();
  188.   %cat = %path @ "/" @ %file;
  189.   
  190.   // MEOW
  191.   eval( $GuiLoadDialogCallback @ "(\"" @ %cat @"\");" );
  192.  
  193.   Canvas.popDialog(LoadFileDlg);
  194. }   
  195.  
  196. function LoadDirTreeEx::onSelectPath( %this, %path )
  197. {
  198.    // Update our file view to reflect the changes
  199.    LoadFileListEx.setPath( %path, $LoadFileExFileSpec  );
  200. }
  201.  
  202.  
  203. function LoadFileListEx::onDoubleClick(%this)
  204. {
  205.    DoOpenFileExCallback();   
  206. }
  207.